#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include<QMenu>
#include <QMainWindow>
#include<QIcon>
#include<QAction>
#include<QNetworkAccessManager>
#include<QNetworkReply>
#include<QDebug>
#include<QJsonObject>
#include<QJsonArray>
#include<QJsonDocument>
#include "weatherdata.h"
#include<QLabel>
#include<QPainter>
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();
protected:
   void contextMenuEvent(QContextMenuEvent *event);
   void mousePressEvent(QMouseEvent *);
   void mouseMoveEvent(QMouseEvent *);
   void getWeatherInfo(QString cityName);
   void parseJson(QByteArray& byteArray);
   void updateUi();
   bool eventFilter(QObject *, QEvent *);
   void paintHighCurve();//绘制低温曲线
   void paintLowCurve();//绘制高温曲线

private slots:
   void on_btnSearch_clicked();

private:
   //槽函数
   void onReplied(QNetworkReply* reply);
private:
    Ui::MainWindow *ui;
    QMenu* mExitMenu;//右键退出菜单
    QAction* mExitAct;//菜单项
    QPoint mOffset;//鼠标和窗口左上角的偏移量
    QNetworkAccessManager* mNetAccess;

    Today mToday;
    Day mDay[6];

    //星期和日期
    QList<QLabel*> mWeekList;
    QList<QLabel*> mDateList;

    //天气和天气图标
    QList<QLabel*> mTypeList;
    QList<QLabel*> mTypeIconList;

    //天气污染指数
    QList<QLabel*> mAqiList;

    //风力和风向
    QList<QLabel*> mFlList;
    QList<QLabel*> mFxiList;

    QMap<QString,QString> mTypeMap;



};

#endif // MAINWINDOW_H
